package com.ltl.keep_book.controller;

import com.ltl.keep_book.model.dto.ItemTypeDTO;
import com.ltl.keep_book.model.po.ItemTypePO;
import com.ltl.keep_book.model.vo.ItemTypeListVO;
import com.ltl.keep_book.result.R;
import com.ltl.keep_book.service.ItemTypeService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/ItemType")
public class ItemTypeControl {

    @Resource
    ItemTypeService itemTypeService;

    @PostMapping("list")
    public R<ItemTypeListVO> list(){
        ItemTypeListVO itemTypeListVO=new ItemTypeListVO();
        itemTypeListVO.setList(itemTypeService.list());
        return R.ok(itemTypeListVO);
    }

    @PostMapping("edit")
    public R<Boolean> edit(@RequestBody ItemTypeDTO itemTypeDTO){
       return R.ok(itemTypeService.edit(itemTypeDTO)==1);
    }
}
